package com.fenquen.dfs.base.model;

public class AjaxResponse {
    public static final AjaxResponse PASS = new AjaxResponse(true, "");
    public Boolean success;
    public String message;

    private AjaxResponse(Boolean success, String errMsg) {
        this.success = success;
        this.message = errMsg;
    }

    public static AjaxResponse fail(String message) {
        return new AjaxResponse(false, message);
    }

    public static AjaxResponse fail(Throwable e) {
        return fail(e.getMessage());
    }

    public static AjaxResponse success(String message) {
        return new AjaxResponse(true, message);
    }
}
